<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人中心 - 智能教育系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
            margin: 0;
            padding-top: 80px;
        }

        .profile-container {
            max-width: 800px;
            margin: 2rem auto;
            padding: 2rem;
            animation: fadeIn 0.5s ease;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .profile-card {
            background: white;
            border-radius: 15px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            padding: 2rem;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .profile-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(110, 142, 251, 0.1), transparent);
            transform: translateX(-100%);
            transition: transform 0.5s ease;
        }

        .profile-card:hover::before {
            transform: translateX(100%);
        }

        .profile-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
        }

        .profile-header {
            text-align: center;
            margin-bottom: 2rem;
            position: relative;
        }

        .profile-avatar {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            background: linear-gradient(135deg, #6e8efb, #a777e3);
            color: white;
            font-size: 3rem;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 1rem;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .profile-avatar::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
            transform: translateX(-100%);
            transition: transform 0.5s ease;
        }

        .profile-avatar:hover::before {
            transform: translateX(100%);
        }

        .profile-avatar:hover {
            transform: scale(1.1);
            box-shadow: 0 0 20px rgba(110, 142, 251, 0.4);
        }

        .profile-info {
            margin-bottom: 2rem;
        }

        .info-item {
            margin-bottom: 1.5rem;
            padding-bottom: 1.5rem;
            border-bottom: 1px solid #eee;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .info-item:hover {
            transform: translateX(10px);
            border-bottom-color: #6e8efb;
        }

        .info-label {
            font-weight: 600;
            color: #666;
            margin-bottom: 0.5rem;
            display: block;
        }

        .info-value {
            color: #333;
            font-size: 1.1rem;
        }

        .alert {
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 1rem;
            animation: slideIn 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .alert::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
            transform: translateX(-100%);
            transition: transform 0.5s ease;
        }

        .alert:hover::before {
            transform: translateX(100%);
        }

        @keyframes slideIn {
            from {
                transform: translateY(-10px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .btn-danger {
            background: linear-gradient(135deg, #ff6b6b, #ff8787);
            border: none;
            padding: 0.75rem 2rem;
            border-radius: 25px;
            color: white;
            font-weight: 600;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .btn-danger::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
            transform: translateX(-100%);
            transition: transform 0.5s ease;
        }

        .btn-danger:hover::before {
            transform: translateX(100%);
        }

        .btn-danger:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
        }
    </style>
</head>
<body>
    <!-- 引入导航栏 -->
    <div th:replace="fragments/navbar :: navbar"></div>

    <div class="profile-container">
        <!-- 提示消息 -->
        <div th:if="${success}" class="alert alert-success" th:text="${success}"></div>
        <div th:if="${error}" class="alert alert-danger" th:text="${error}"></div>

        <div class="profile-card">
            <div class="profile-header">
                <div class="profile-avatar" th:text="${session.user.username.substring(0,1).toUpperCase()}"></div>
                <h2 class="mb-2" th:text="${session.user.username}">用户名</h2>
                <p class="text-muted" th:text="${session.user.role.name() == 'TEACHER' ? '教师' : '学生'}">角色</p>
            </div>

            <div class="profile-info">
                <div class="info-item">
                    <span class="info-label">用户名：</span>
                    <span th:text="${session.user.username}">用户名</span>
                </div>
                <div class="info-item">
                    <span class="info-label">角色：</span>
                    <span th:text="${session.user.role.name() == 'TEACHER' ? '教师' : '学生'}">角色</span>
                </div>
                <div class="info-item">
                    <span class="info-label">邮箱：</span>
                    <span th:text="${session.user.email}">邮箱</span>
                </div>
            </div>

            <div class="text-center">
                <a href="/simple-logout" class="btn btn-danger">退出登录</a>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 添加页面滚动效果
        window.addEventListener('scroll', function() {
            const profileCard = document.querySelector('.profile-card');
            const scrollPosition = window.scrollY;
            
            if (scrollPosition > 100) {
                profileCard.style.transform = 'translateY(-5px)';
            } else {
                profileCard.style.transform = 'translateY(0)';
            }
        });

        // 添加信息项悬停效果
        document.querySelectorAll('.info-item').forEach(item => {
            item.addEventListener('mouseenter', function() {
                this.style.transform = 'translateX(10px)';
            });
            
            item.addEventListener('mouseleave', function() {
                this.style.transform = 'translateX(0)';
            });
        });
    </script>
</body>
</html> 